//RectPrism.cpp
//Contains the function definitions for the Rectangular Prism Class

#include <iostream>
#include "RectPrism.h"

using namespace std;

RectPrism::RectPrism(const float &p_X, const float &p_Y, float len, float wid, float hgt)
	: NonCircularShapes(p_X, p_Y, len, wid)
{
	setHeight(hgt);
	setVol();
	setPerimeter(0,0);
	//setDistance();
	setShapeType("Rectangular Prism");
}

void RectPrism::setHeight(float hgt)
{
	if (hgt >= 0.0)
		height = hgt;
	else
		throw invalid_argument("The height must be greater than zero.");
}

float RectPrism::getHeight() const
{
	return height;
}

void RectPrism::setVol()
{
	RP_volume = getHeight() * NonCircularShapes::getArea();
}

float RectPrism::getRpVol() const
{
	return RP_volume;
}

float RectPrism::volume() const
{
	return getRpVol();
}


